﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication1
{
    public class Status
    {
        public int hartslag { get; set; }
        public int RPM { get; set; }
        public double snelheid { get; set; }
        public int afstand { get; set; }
        public int power { get; set; }
        public int Kj { get; set; }
        public string tijdMinuten { get; set; }

        public Status(int hartslag, int rpm, double snelheid, int afstand, int power, int Kj, string tijdMinuten)
        {
            this.hartslag = hartslag;
            this.RPM = rpm;
            this.snelheid = snelheid;
            this.afstand = afstand;
            this.power = power;
            this.Kj = Kj;
            this.tijdMinuten = tijdMinuten;
        }

        public static Status createStatus(string s)
        {
            string[] list = s.Split(new string[] { "	" }, StringSplitOptions.None);

            if (list.Length != 8)
            {
                return null;
            }
            return new Status(int.Parse(list[0]),
                                int.Parse(list[1]),
                                (double.Parse(list[2])/10),
                                int.Parse(list[3]),
                                int.Parse(list[4]),
                                int.Parse(list[5]),
                                list[6]);
        }

        public override string ToString()
        {
            return "Time: " + tijdMinuten + "  Heartbeat: " + hartslag + "  RPM: " + RPM +
                "  Speed: " + snelheid + "  Distance: " + afstand + "  Power: " + power + "  Kj: " + Kj;
        }
    }
}
